home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / bccapp.zip / FIELD.H < prev    next >
C/C++ Source or Header  |  1991-09-15  |  3KB  |  121 lines

  1. /*
  2.  *
  3.  * Field editing system.
  4.  *
  5.  * (C) 1990 Vision Software
  6.  *
  7.  * $Id: field.h 1.2002 91/05/04 17:19:57 pcalvin beta $
  8.  *
  9.  * Comments:
  10.  *
  11.  * Right now, this system is just used by EDIT to handle I/O for each field
  12.  * in the edit.  In the future, it may be used by others (such is interactive
  13.  * dialog boxes)
  14.  *
  15.  * Bugs:
  16.  *
  17.  * None documented
  18.  *
  19.  */
  20. #if (!defined(__FIELD__))
  21. #define __FIELD__
  22.  
  23. #if (!defined(__ADL__))
  24. #include <adl.h>
  25. #endif
  26.  
  27. #if (!defined(__MENU__))
  28. #include <menu.h>
  29. #endif
  30.  
  31. /*
  32.  * Validation functions.
  33.  */
  34. typedef BOOL (*PFN)(SZ sz,VOID *pv = Nil);
  35. static const PFN pfnNil = 0;
  36.  
  37. /*
  38.  * Titles/Headers that may be put anywhere on the screen
  39.  */
  40. struct IF
  41.     {
  42. public:
  43.     IF(WINDOW &rwnd,ROW rowStart,COL colStart,SZ sz);
  44.     VOID SayMessage();
  45.     ROW RowEdit();
  46.     COL ColRight();
  47.     COL ColLeft();
  48.  
  49.     struct IF *pifPrev;
  50.     struct IF *pifNext;
  51.  
  52. protected:
  53.     WINDOW &rwnd;
  54. private:
  55.     SZ szMessage;                  /* Message  */
  56.     ROW row;                    /* Offset within the window.. */
  57.     COL col;
  58.     };
  59. typedef IF *PIF;
  60. STATIC CONST PIF pifNil = 0;
  61.  
  62. /*
  63.  * Edit Ordered field.  An extension of the the information field, this
  64.  * one may be dynamic..
  65.  */
  66. struct ED : public IF
  67.     {
  68. public:
  69.     ED(WINDOW &rwnd,ROW row,COL col,SZ szMsg,SZ sz,SZ szPicture,SZ szHelp,SZ szDefault);
  70.     ED(WINDOW &rwnd,ROW row,COL col,SZ szMsg,SZ sz,CHAR chPicture,CCH cch,SZ szHelp,SZ szDefault);
  71.     ED(WINDOW &rwnd,ROW row,COL col,SZ szMsg,SZ sz,CCH cch,SZ szHelp,CENT cent,PENT pent,CENT centDflt);
  72.     BOOL FInsertCd(CD cd);
  73.     BOOL FDelete();
  74.     BOOL FModified();
  75.     BOOL FValidate();
  76.     VOID CursorLeft();
  77.     VOID CursorRight();
  78.     VOID SayEdit(BOOL fCurrent);
  79.     VOID Adjust(PFN pfn,VOID *pv,BOOL fCareIfFieldChanges);
  80.     VOID UpdateHelp(HELP &rhelp);
  81.     VOID Clear();
  82.     VOID ShowDelimiters(CHAR chLeft,CHAR chRight);
  83.     VOID SetUnchanged();
  84.     VOID SetCursor();
  85.     COL ColLeft();
  86.     COL ColRight();
  87.     COL ColEdit();
  88. private:
  89.     CHAR ChPicture();
  90.     BOOL FValidChCh(CHAR &rch,CHAR chPicture);
  91.     BOOL FValidateRange();
  92.     BOOL FValidateFunction();
  93.     BOOL FInRange();
  94.     BOOL FIsConstantPic();
  95.     BOOL FAdvanceCursor();
  96.     BOOL FStripLeader();
  97.     BOOL FInsertLeader();
  98.     COL DcolOffset();
  99.     SZ sz;                            /* Place edit here.. */
  100.     SZ szHelp;                        /* Help message */
  101.     SZ szPicture;                    /* Simple validation string */
  102.     SZ szDefault;                    /* Default value when the field is cleared */
  103.     CHAR chPicture;                /* Single charcter picture for input */
  104.     PFN pfnValid;                    /* Validation Function */
  105.     VOID *pvValid;                    /* Pointer passed to validation function */
  106.     CENT centValid;                /* Number of entries in validation array */
  107.     PENT pentValid;                /* Validation array.. */
  108.     COL dcol;                        /* Offset for edit cursor */
  109.     CCH cchMax;                        /* Max Length of field */
  110.     CCH cchMac;                        /* Current length of field */
  111.     CCH cchCurrent;                /* Current offset for editing */
  112.     BOOL fChanges;                    /* Has this field been modified */
  113.     BOOL fCareAboutChanges;        /* Do we CARE if this field changes?? */
  114.     BOOL fNumeric;
  115.     };
  116.  
  117. typedef ED *PED;
  118. STATIC CONST PED pedNil = 0;
  119.  
  120. #endif    /* !defined(__FIELD__) */
  121.